#ifndef _LOG_SYSTEM_H_
#define _LOG_SYSTEM_H_

///=================================================================================================
/// LOG SYSTEM
///
/// v 3.0.0
///=================================================================================================

#include "WriterCatalog.h"
#include "GlobalLog.h"
#include "core/core_utils.h"

#define THROW_AND_LOG(APPENDER, TYPE, MESSAGE) \
	glog::__throw_and_log<TYPE>(__FILE__, __LINE__,APPENDER, MESSAGE, #TYPE)

namespace glog{
	template<typename T>
	void __throw_and_log(std::string file, unsigned int line,std::string appender, std::string message, std::string type)
	{
		CGlobalLog::getSingleton().ERROR_MSG(appender,"%s: %d Exception of type %s. Description:\n\t%s",file.c_str(), line, type.c_str(), message.c_str() );
		lpe::core::launchException<T>(file, line, message);
		CGlobalLog::getSingleton().processMessages();
		throw;
	}
}

#endif //_LOG_SYSTEM_H_
